﻿using YDT_PaymentService.Applictions.DTOs;

namespace YDT_PaymentService.Applictions.Interfaces
{
    /// <summary>
    /// 支付应用服务接口 - 定义支付业务操作
    /// </summary>
    public interface IPaymentService
    {
        /// <summary>根据ID获取支付记录</summary>
        Task<PaymentDto?> GetPaymentByIdAsync(Guid id);
        /// <summary>根据支付单号获取支付记录</summary>
        Task<PaymentDto?> GetPaymentByCodeAsync(string paymentCode);
        /// <summary>根据订单ID获取支付记录</summary>
        Task<PaymentDto?> GetPaymentByOrderIdAsync(Guid orderId);
        /// <summary>获取用户的所有支付记录</summary>
        Task<IEnumerable<PaymentDto>> GetPaymentsByUserIdAsync(Guid userId);
        /// <summary>获取所有支付记录</summary>
        Task<IEnumerable<PaymentDto>> GetAllPaymentsAsync();
        /// <summary>分页查询支付记录</summary>
        Task<(IEnumerable<PaymentDto> Payments, int TotalCount)> GetPagedPaymentsAsync(PaymentQueryDto query);
        /// <summary>创建支付记录</summary>
        Task<PaymentDto> CreatePaymentAsync(CreatePaymentDto createPaymentDto);
        /// <summary>更新支付记录</summary>
        Task<PaymentDto?> UpdatePaymentAsync(Guid id, UpdatePaymentDto updatePaymentDto);
        /// <summary>删除支付记录</summary>
        Task<bool> DeletePaymentAsync(Guid id);
        /// <summary>初始化支付</summary>
        Task<PaymentDto?> InitializePaymentAsync(Guid id, InitializePaymentDto initializeDto);
        /// <summary>处理支付成功</summary>
        Task<PaymentDto?> ProcessPaymentSuccessAsync(string paymentCode);
        /// <summary>处理支付失败</summary>
        Task<PaymentDto?> ProcessPaymentFailureAsync(string paymentCode, string errorNo, string errorInfo);
        /// <summary>取消支付</summary>
        Task<PaymentDto?> CancelPaymentAsync(Guid id);
        /// <summary>开始退款流程</summary>
        Task<PaymentDto?> StartRefundAsync(Guid id);
        /// <summary>处理退款成功</summary>
        Task<PaymentDto?> ProcessRefundSuccessAsync(Guid id);
        /// <summary>处理退款失败</summary>
        Task<PaymentDto?> ProcessRefundFailureAsync(Guid id, string errorNo, string errorInfo);
    }
}
